package com.example.dao;

import com.example.domain.Candidate;
import com.example.domain.Employment;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author luo
 */
@Mapper
public interface EmploymentDao {
    /**
     * 查询全部岗位
     *
     * @return
     */
    @Select("select * from employment")
    public List<Employment> selectAllEmploy();

    /**
     * id查找
     * @param id
     * @return
     */
    @Select("select * from employment where id = #{id}")
    public Employment selectEmployById(Integer id);

    /**
     * 模糊查询
     * @param employment
     * @return
     */
//    @Select("select * from employment where position like #{position};")
    public List<Employment> selectEmploymentByName(Employment employment);

    /**
     * 添加招聘信息
     *
     * @param employment
     * @return
     */
    @Insert("insert into employment (position, salary, num, content, phone,year) values (#{position}, #{salary}, #{num}, #{content}, #{phone}, #{year})")
    public int addEmployment(Employment employment);

    /**
     * 更新招聘信息
     *
     * @param employment
     * @return
     */
    @Update("update employment set position=#{position},salary=#{salary},num=#{num},content=#{content},phone=#{phone},year=#{year} where id=#{id};")
    public int updateEmployment(Employment employment);

    /**
     * 根据id删除
     * @param id
     * @return
     */
    @Delete("delete from employment where id=#{id};")
    public int deleteEmployment(Integer id);
}
